package bg.btanev.eightyfour.shared.dto.person;

import java.util.HashSet;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import bg.btanev.eightyfour.shared.dto.TargetDto;
import bg.btanev.eightyfour.shared.dto.dtobase.DomainDtoEntity;
import bg.btanev.eightyfour.shared.dto.experience.EducationExperienceDto;
import bg.btanev.eightyfour.shared.dto.experience.WorkExperienceDto;
import bg.btanev.eightyfour.shared.dto.geo.GeoLocationDto;

/**
 *
 * @author B.Tanev
 *
 */
public class PersonDto extends DomainDtoEntity<Long> {
	/**
	 *
	 */
	private static final long serialVersionUID = -7455399143945870310L;

	private PersonNameDto personName;
	private ContactInfoDto contactInfo;
	private GeoLocationDto geoLocation;

	private SortedSet<WorkExperienceDto> workExperiences = new TreeSet<WorkExperienceDto>();
	private SortedSet<EducationExperienceDto> educationExperiences = new TreeSet<EducationExperienceDto>();

	private Set<PersonDto> relatedPersons = new HashSet<PersonDto>();

	private TargetDto target;

	public PersonDto() {
		super();
	}

	public PersonDto(PersonNameDto personName, ContactInfoDto contactInfo) {
		super();
		this.personName = personName;
		this.contactInfo = contactInfo;
	}

	public PersonNameDto getPersonName() {
		return personName;
	}

	public void setPersonName(PersonNameDto personName) {
		this.personName = personName;
	}

	public ContactInfoDto getContactInfo() {
		return contactInfo;
	}

	public void setContactInfo(ContactInfoDto contactInfo) {
		this.contactInfo = contactInfo;
	}

	public GeoLocationDto getGeoLocation() {
		return geoLocation;
	}

	public void setGeoLocation(GeoLocationDto geoLocation) {
		this.geoLocation = geoLocation;
	}

	public SortedSet<WorkExperienceDto> getWorkExperiences() {
		return workExperiences;
	}

	public void setWorkExperiences(SortedSet<WorkExperienceDto> workExperiences) {
		this.workExperiences = workExperiences;
	}

	public SortedSet<EducationExperienceDto> getEducationExperiences() {
		return educationExperiences;
	}

	public void setEducationExperiences(SortedSet<EducationExperienceDto> educationExperiences) {
		this.educationExperiences = educationExperiences;
	}

	public Set<PersonDto> getRelatedPersons() {
		return relatedPersons;
	}

	public void setRelatedPersons(Set<PersonDto> relatedPersons) {
		this.relatedPersons = relatedPersons;
	}

	public TargetDto getTarget() {
		return target;
	}

	public void setTarget(TargetDto target) {
		this.target = target;
	}

	@Override
	public String toString() {
		return "PersonDto [contactInfo=" + contactInfo + ", geoLocation=" + geoLocation + ", personName=" + personName
				+ ", workExperiences=" + workExperiences + ", toString()=" + super.toString() + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((contactInfo == null) ? 0 : contactInfo.hashCode());
		result = prime * result + ((personName == null) ? 0 : personName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonDto other = (PersonDto) obj;
		if (contactInfo == null) {
			if (other.contactInfo != null)
				return false;
		} else if (!contactInfo.equals(other.contactInfo))
			return false;
		if (personName == null) {
			if (other.personName != null)
				return false;
		} else if (!personName.equals(other.personName))
			return false;
		return true;
	}
}
